﻿using System.Collections.Generic;
using System.Web.Script.Serialization;
using Taype.Trading.BTC.Utilities;

namespace Taype.Trading.BTC.MtGoxAPIClient.JSONObjects
{
    /// <summary>
    /// Encapsulates information returned by getDepth v0 API
    /// </summary>
    public class MtGoxDepthInfo
    {
        public List<MtGoxAsk> asks { get; set; }

        public List<MtGoxBid> bids { get; set; }

        public MtGoxDepthInfo()
        {
            this.asks = new List<MtGoxAsk>();
            this.bids = new List<MtGoxBid>();
        }
        
        /// <summary>
        /// Parse the JSON data returned by the 0/getDepth.php method 
        /// </summary>
        /// <param name="jsonDataStr">JSON data returned by the 0/getDepth.php method</param>
        /// <returns></returns>
        public static MtGoxDepthInfo getObjects(string jsonDataStr)
        {
            // "{\"asks\":[[5.2989,29.78],[5.29898,21.91],[5.299,27.32],[5.29999,20],[5.3,444.68220057],[5.30083,0.3112],[5.3009,0.01],[5.3014,3.53190577],[5.30295,0.02544],[5.30338,0.0598],[5.30437,0.0126238],[5.3063,1.08692886],[5.30672,0.05232],[5.30677,17.20358819],[5.30683,0.03623],[5.30906,2.58037364],[5.30997,0.78592106],[5.30999,7.31113633],[5.31,59.23937075],[5.31068,24.54714188],[5.31075,0.06277],[5.31091,5.05843175],[5.311,0.01],[5.3117,0.05131],[5.31191,0.08582],[5.31224,8.16977537],[5.31304,1],[5.31419,3.50586803],[5.31457,0.30442],[5.31629,0.05897],[5.31859,0.19586],[5.31867,1.13967862],[5.31922,0.10856],[5.31974,0.18452],[5.3199,0.03887679],[5.32,52.05465701],[5.32069,23.79675],[5.321,0.01],[5.322,21.87553377],[5.32249,3.78445489],[5.3225,0.07],[5.32287,1.6807746],[5.32291,1.24712],[5.32581,0.03727],[5.3265,0.32590592],[5.33,38.83774915],[5.331,0.01],[5.33124,0.06914],[5.33236,2.52954732],[5.33266,0.07931],[5.3333,5.3333],[5.33333,40],[5.335,24],[5.33624,0.08099],[5.33634,9.9],[5.33646,30],[5.3396,3.85840792],[5.33999,0.41],[5.34,10.3498642],[5.34007,9.74341],[5.34078,0.05044],[5.341,0.01],[5.34164,0.21181551],[5.34186,0.1694],[5.34242,7],[5.34434,6.8],[5.34443,0.12775],[5.34455,10],[5.34601,1.46754],[5.3462,0.18301],[5.34688,0.11309],[5.347,10],[5.34732,0.35156974],[5.34899,0.27],[5.34908,0.0205315],[5.3499,3.704638],[5.35,362.26786312],[5.35008,11],[5.351,0.01],[5.35103,0.04321],[5.35162,0.81519665],[5.35203,0.0250488],[5.35355,250],[5.35454,0.53625804],[5.35472,0.52704609],[5.35478,0.0958216],[5.355,0.9947],[5.35582,3.10298619],[5.35602,0.08824],[5.35679,0.13504],[5.35732,0.5565],[5.35776,0.06873],[5.359,3],[5.36,10.84053542],[5.361,0.01],[5.36242,0.45216087],[5.36288,1.326266],[5.364,25],[5.36494,6.8137],[5.36496,0.0493024],[5.36545,0.24169637],[5.36627,103.26236894],[5.36628,10],[5.3676,0.25677],[5.36778,2.78866266],[5.368,0.10664],[5.36979,7.59077755],[5.36999,0.01],[5.37,309.57374152],[5.3705,0.09234],[5.3709,9.63893988],[5.371,0.01],[5.373,1.07],[5.37321,0.42221637],[5.37322,0.07757],[5.37576,0.0205159],[5.37652,0.14522],[5.378,65],[5.3787,7.44298822],[5.379,1001.0862],[5.37993,40.81922],[5.38,0.3406158],[5.38001,98.64659383],[5.38047,6.08862978],[5.38054,0.0244524],[5.38089,0.116034],[5.38258,0.27284],[5.384,100],[5.38418,0.64221],[5.38772,5],[5.38844,0.18453],[5.38849,1.237664],[5.38872,0.89787453],[5.389,100],[5.3891,0.0205054],[5.38919,1.14739],[5.38947,0.26087],[5.38986,1.0247871],[5.38995,0.0836948],[5.39,263.66088932],[5.393,22.63470515],[5.39361,0.22445],[5.39379,6.43477752],[5.39438,1.326266],[5.395,10],[5.39505,0.01348],[5.3956,0.0518868],[5.39676,0.1592388],[5.39677,3],[5.3987,49.69483815],[5.39879,100],[5.3989,40],[5.39967,2.69243492],[5.39999,8],[5.4,773.50827681],[5.40244,0.0204876],[5.4029,0.0927402],[5.40323,0.0125244],[5.4067,0.0254464],[5.41,67.2343484],[5.41014,0.0808122],[5.41156,1.38465661],[5.41249,0.49024],[5.41299,0.21862],[5.41578,3.0024732],[5.41623,3.06087407],[5.418,0.9947],[5.41811,6.80994892],[5.41907,8.86975],[5.42,126.30019143],[5.42098,7.94276012],[5.42099,1],[5.421,365.15135854],[5.42285,0.21368],[5.42381,1],[5.425,42.26],[5.42594,0.212716],[5.42604,0.0883666],[5.42725,0.9947],[5.42856,5.42501633],[5.42865,30.36097571],[5.42912,0.0204576],[5.4296,1.28521449],[5.42971,0.40191],[5.43,13.524333],[5.43081,0.92399373],[5.43165,0.37917],[5.43593,9.8],[5.43864,10.70073552],[5.44,84.1754913],[5.44245,0.0204409],[5.443,9.1863802],[5.44393,0.19742],[5.44431,0.08317565],[5.44772,5],[5.449,127.5880848],[5.4496,4.26818203],[5.44999,34],[5.45,698.4411111],[5.451,20],[5.45106,0.08087],[5.45145,1.4183],[5.45215,22],[5.45571,30.1],[5.45579,4.9654251],[5.45641,0.1126],[5.45895,8.46743845],[5.45984,0.0366786],[5.4599,69.92313],[5.46,63.28479789],[5.461,127.11],[5.4656,0.10264],[5.4666,7.8600367],[5.467,1],[5.46913,0.0204088],[5.46946,0.74569452],[5.46999,250],[5.47,585.33056272],[5.471,0.0155],[5.47298,4.39866876],[5.4747,10],[5.475,142.89],[5.47516,0.69035626],[5.47835,14],[5.47931,7.85623118],[5.47933,0.01],[5.47983,1.45419641],[5.47997,4],[5.47999,250],[5.48,62.98855039],[5.48064,0.67704786],[5.481,0.9947],[5.482,1.5415946],[5.48235,4],[5.48247,0.0203956],[5.48435,15.91168629],[5.48437,9.9],[5.48448,1.85655],[5.485,50],[5.48733,3.36453142],[5.488,448.2],[5.48821,0.23756623],[5.4889,10],[5.489,405.5140876],[5.4891,11.9448],[5.48914,9.945],[5.4899,20],[5.48996,16.80056389],[5.48999,1],[5.49,30.4506256],[5.49095,1.68846064],[5.492,0.5],[5.49234,0.71724],[5.493,25],[5.49375,0.34953],[5.49378,1.96912401],[5.49446,25.7],[5.49499,25.98],[5.495,18.4018],[5.49569,0.7060411],[5.49581,0.0203874],[5.49599,2832.65],[5.497,51.41889807],[5.49726,35],[5.498,0.0155],[5.4981,69.56823413],[5.4985,10],[5.49885,2.81300774],[5.499,523.31767633],[5.49904,0.66283958],[5.49917,1.28055],[5.4999,56.17153429],[5.49998,27.74505962],[5.49999,143.82925288],[5.5,1808.05933267],[5.50237,1.87175866],[5.50274,9.9],[5.50424,0.74054429],[5.50425,0.0399],[5.50739,0.2406],[5.50915,2.0093732],[5.50996,3.77558409],[5.51,106.3164502],[5.51533,6.5107],[5.51761,5.98713244],[5.51846,6.768146],[5.52,12.5409455],[5.521,5],[5.52249,0.0203632],[5.52329,1.1627456],[5.52688,0.3552],[5.52738,0.05143],[5.52894,0.4078],[5.53,177.42836691],[5.531,10],[5.53153,0.95665096],[5.5335,1.36036],[5.53461,0.43185767],[5.5355,0.02879],[5.53583,121.0203548],[5.53652,1.45674459],[5.537,2.05],[5.54,43.99250175],[5.54001,5],[5.54173,10],[5.54226,1.34246],[5.544,100],[5.54508,0.91221],[5.546,0.22698],[5.54917,0.0203243],[5.5499,13.2973063],[5.55,327.34395416],[5.5522,9.88],[5.55703,0.4895],[5.559,1.5],[5.5596,0.94577019],[5.56,5.3304304],[5.56251,0.02029],[5.5632,0.11943],[5.56447,0.3372387],[5.5667,0.38],[5.5697,0.30933333],[5.57,4.3304262],[5.575,10],[5.57585,0.0202832],[5.57925,0.42040003],[5.57944,1.08985],[5.58,31.8304213],[5.58082,0.21784599],[5.581,603.3611509],[5.58178,0.0202728],[5.58843,5.71664521],[5.589,100],[5.58919,9.9102788],[5.59,1.23419827],[5.59143,0.17738208],[5.596,2],[5.59985,50.74],[5.5999,6],[5.59993,0.12],[5.6,849.22529219],[5.60175,10],[5.60179,0.26185],[5.60253,30.1750752],[5.60477,19],[5.606,30],[5.60969,0.95420825],[5.61,26.64029423],[5.61049,0.926],[5.6114,1.41105],[5.612,0.997],[5.61354,0.15686],[5.61618,1.9894],[5.61664,0.02918],[5.61848,0.87840327],[5.62,0.3101619],[5.621,10],[5.62536,0.57140727],[5.626,306.78],[5.62921,0.0202688],[5.63,0.3101637],[5.631,10],[5.63178,0.42221637],[5.63191,0.16],[5.632,156.78],[5.63275,1.538813],[5.633,1.07],[5.63481,0.020258],[5.636,105.3582528],[5.63666,0.15465],[5.63994,435.3],[5.64,5.5606638],[5.64255,0.020266],[5.643,6.065388],[5.649,3.823584],[5.65,255.00018015],[5.65112,0.2076],[5.65588,0.020262],[5.65843,5],[5.6595,0.9947],[5.66,8.5601642],[5.6608,0.13564],[5.661,0.1],[5.66439,7],[5.665,0.01],[5.6691,10.4],[5.67,6.1363345],[5.67382,0.12885],[5.678,55.66021829],[5.68,37.80607943],[5.681,10],[5.68256,0.0202548],[5.68495,0.62617244],[5.68745,12.25874],[5.689,100],[5.69,147.8936431],[5.69009,6.7095],[5.6911,86.22834546],[5.69421,10.79842842],[5.6959,0.0202508],[5.69619,0.28238],[5.7,576.98581784],[5.70464,0.50455812],[5.706,1.07],[5.70924,0.0202444],[5.71,361.9501359],[5.713,5],[5.72,20.1101358],[5.72013,22],[5.72258,5.8578848],[5.72587,0.11843],[5.72592,1.53894],[5.73,1.1048724],[5.731,0.0155],[5.732,10],[5.734,0.27325],[5.73559,2.56682473],[5.73592,2.0202056],[5.739,0.0299],[5.74,3.03785094],[5.744,100],[5.745,500],[5.749,2],[5.74926,0.0201992],[5.7499,10],[5.75,224.0122393],[5.751,10],[5.7584,0.1513],[5.75942,0.69621],[5.76,0.0507491],[5.76059,6.29],[5.7626,0.0201944],[5.76516,1.94186],[5.77,46.376167],[5.77025,2.99184],[5.77113,0.01041],[5.77594,6.9311904],[5.778,25],[5.77993,10],[5.77994,6.98],[5.78,131.6322516],[5.78589,4.75],[5.7889,150],[5.789,100],[5.78928,0.0201872],[5.79,49.0595866],[5.79059,0.30225],[5.795,103.949436],[5.79699,0.01],[5.797,1000],[5.79979,8.8],[5.79999,0.01],[5.8,1795.93859559],[5.80262,3.020186],[5.80375,0.74236],[5.805,0.994],[5.80717,0.020182],[5.80788,0.68048],[5.809,20],[5.81,3.48883744],[5.81027,1.5823],[5.81346,10.8],[5.81596,0.0201844],[5.82,61.1477426],[5.8214,0.7215],[5.828,0.29526],[5.8293,0.0201828],[5.83,0.0102372],[5.83028,15.2189426],[5.833,10],[5.83301,0.95043],[5.8333,19.62406616],[5.837,1.05],[5.8396,1],[5.83999,0.25],[5.84,0.2602318],[5.841,0.01373],[5.84278,1.66427],[5.849,38.06622368],[5.8499,10],[5.85,111.9072114],[5.85597,0.0201812],[5.856,1.80932],[5.86,5.690221],[5.86712,0.305],[5.86931,0.0201804],[5.87,425.17990069],[5.87002,79.76],[5.875,17.850798],[5.88,53.6],[5.88265,0.0201804],[5.88386,0.97542],[5.88499,0.32148],[5.8875,1.500336],[5.889,100],[5.89,215.5059352],[5.8949,10],[5.89599,0.0201804],[5.89699,1],[5.897,1000],[5.898,0.994],[5.8988,1],[5.89998,0.02018],[5.9,1654.2505126],[5.90168,0.45441],[5.90266,10.91293],[5.90289,4.97],[5.90613,0.09003],[5.90704,0.23166],[5.90933,0.0201804],[5.91,0.08915053],[5.91324,0.015],[5.92,2.17675792],[5.92059,1],[5.922,0.31658],[5.92267,0.0201804],[5.923,0.01],[5.93,23.92581336],[5.933,10],[5.9369,0.42221637],[5.9379,0.7073],[5.94,378],[5.944,93],[5.949,2],[5.94935,0.0201796],[5.9499,10],[5.95,1530.8],[5.951,10],[5.9536,0.18108],[5.95656,7.4],[5.9595,10],[5.96,7],[5.96202,1.78709],[5.96252,23.64714588],[5.96269,0.0201792],[5.96627,0.01],[5.97,1127.37445515],[5.97603,0.0201788],[5.97939,0.34011],[5.98,13.19421667],[5.98006,0.04146],[5.983,5],[5.985,3.07],[5.98689,5],[5.987,201],[5.988,40.0299],[5.989,239.23054795],[5.98937,0.0201776],[5.99,584.8845],[5.992,0.0155],[5.997,186.67692612],[5.998,43],[5.9999,6.37165446],[6,3418.59760021],[6.00271,67.9201764],[6.01,10.98],[6.016,0.33723],[6.01605,0.0201752],[6.0193,0.0202624],[6.0236,0.20388],[6.02939,0.020268],[6.03,10],[6.03169,0.01618],[6.034,10],[6.04,8],[6.04001,5],[6.04273,96.20158027],[6.04292,1],[6.045,4.9633402],[6.05,2.0317],[6.0512,0.19525],[6.0566,0.6935],[6.06,1],[6.0694,0.0201616],[6.07379,0.35815],[6.07405,10],[6.07705,100],[6.08,0.5],[6.08274,0.0201596],[6.08369,1.90746],[6.089,100],[6.09608,0.0201568],[6.1,400.65026775],[6.10942,0.0201524],[6.11,1.38724],[6.11827,6.06315449],[6.12,67.1895],[6.134,10],[6.1361,0.027],[6.1488,0.20897],[6.15,32.1545275],[6.165,1.02],[6.16819,0.37564],[6.17282,4.43104],[6.1778,0.6799],[6.18,70.01],[6.18078,0.0414],[6.188,0.5],[6.19598,11.7887],[6.198,1],[6.199,74.11],[6.2,234.11],[6.20785,2.02542],[6.21,2],[6.22,0.00044362],[6.23,16.62159995],[6.231,5],[6.2313,50],[6.23572,2.87312],[6.238,0.0299],[6.24,0.0805],[6.2464,0.22226],[6.249,2],[6.25,27.104389],[6.252,0.0155],[6.26065,4.55],[6.26259,0.39261],[6.2693,1],[6.28,848.771],[6.28306,0.34767],[6.28654,14.38574479],[6.288,0.5],[6.289,78.77737321],[6.29131,21.02595],[6.29999,0.15],[6.3,212.02256315],[6.3014,0.6665],[6.30262,10],[6.31261,0.33481],[6.33,1.04],[6.33454,2.14102],[6.33619,5.04],[6.33816,21],[6.34064,3.07356],[6.344,1.60242]],\"bids\":[[4.49704,0.02167114],[4.4981,0.01],[4.4982,0.51583011],[4.5,8425.41267582],[4.5001,270.6607],[4.5002,16.1283],[4.50025,20],[4.501,691.06345478],[4.5012,510],[4.5017,6.62],[4.502,93.1915904],[4.50424,0.0207321],[4.50475,0.53575],[4.50501,21.7536],[4.5069,0.0216601],[4.508,0.51573935],[4.5081,0.01],[4.5098,0.04574509],[4.51,614.68653391],[4.511,110],[4.51144,0.50773],[4.51372,1.5],[4.515,3],[4.51677,0.02164815],[4.5178,0.46517708],[4.5181,0.01],[4.51961,0.04574118],[4.52,894.05444424],[4.5203,0.41396588],[4.52109,0.019],[4.52111,5],[4.52155,8.8124],[4.52362,0.04787],[4.524,100],[4.525,523.21003535],[4.526,4],[4.52663,0.02163302],[4.5276,0.46508281],[4.5281,0.01],[4.52913,0.02072733],[4.52941,0.04573828],[4.53,0.22],[4.53051,1.06964315],[4.5307,100],[4.531,220],[4.53243,0.043],[4.53347,0.42221637],[4.5351,0.01009471],[4.5353,10],[4.5354,0.96389],[4.53649,0.02165572],[4.5374,0.46552732],[4.5381,0.01],[4.53922,0.04573277],[4.54,234.82],[4.54017,34.3],[4.54018,344.49315665],[4.54157,0.02072367],[4.54317,0.16735],[4.545,100],[4.54635,0.02164417],[4.5472,0.46545495],[4.5481,0.01],[4.54902,0.04572745],[4.54924,0.30617],[4.5499,0.4728],[4.55,424.07395604],[4.5512,9.9],[4.55401,0.02072871],[4.555,100],[4.55609,0.38475],[4.55621,0.02163171],[4.55634,2.61624],[4.557,0.46540726],[4.5581,0.01],[4.55882,0.04572144],[4.56,532.83196754],[4.56252,10.87227],[4.565,100],[4.56504,50],[4.56607,0.02161461],[4.56645,0.02073624],[4.5668,0.46535418],[4.56716,5.33724],[4.5681,0.01],[4.56863,0.04572017],[4.57,100],[4.57077,41.06],[4.57215,0.015],[4.574,0.023],[4.575,100],[4.57594,0.02159742],[4.5763,30],[4.5766,0.46528276],[4.5781,0.01],[4.57843,0.04571386],[4.5789,0.02072884],[4.58,100.02655676],[4.58347,50],[4.585,100],[4.5858,0.02158356],[4.5864,0.46519299],[4.5881,0.01],[4.58824,0.04570766],[4.58863,33.95979627],[4.58884,0.05584],[4.59,114.52137472],[4.59096,0.44539],[4.59134,0.02070812],[4.595,100],[4.59566,0.0215694],[4.5962,0.46510693],[4.59692,5.34508463],[4.59804,0.045701],[4.5981,0.01],[4.5987,28.14362506],[4.6,880.34300867],[4.60002,0.031],[4.6012,9.9],[4.602,1.44237],[4.60268,0.49179],[4.60299,4.79858092],[4.60376,0.90721],[4.60378,0.02088064],[4.60552,0.02155394],[4.606,0.46500254],[4.60663,6.90121865],[4.60784,0.04569095],[4.6081,0.01],[4.60867,5.38748],[4.6099,0.5],[4.61,67.27032754],[4.611,110],[4.61115,0.04596],[4.61123,100],[4.612,100],[4.6125,20],[4.614,100],[4.615,110],[4.61538,0.0215506],[4.6158,0.46500701],[4.61622,0.02087697],[4.61765,0.04568667],[4.6181,0.01],[4.62,1],[4.62144,50],[4.62156,10.22],[4.62525,0.02153622],[4.6256,0.46491818],[4.62745,0.06717244],[4.6281,0.01],[4.62867,0.02087416],[4.63,89.5],[4.63071,0.012],[4.63425,1],[4.635,0.92892],[4.63511,0.0215186],[4.6354,0.46484453],[4.6366,0.128279],[4.63725,0.06715741],[4.6381,0.01],[4.64,27.77309129],[4.64111,0.02086701],[4.64397,0.40846],[4.64478,1],[4.64497,0.02121859],[4.6452,0.4647587],[4.64555,0.13138],[4.647,1.02],[4.64706,0.06743014],[4.6481,0.01],[4.64932,2.34154],[4.65,634.03842471],[4.65001,11.43],[4.65012,9.9],[4.6505,25],[4.6515,3],[4.65202,0.30572],[4.65355,0.02086544],[4.655,0.46825259],[4.65567,16.53677],[4.65686,0.0674581],[4.6581,0.01],[4.65825,1.58978],[4.66,108.25291051],[4.6616,6.8],[4.6625,5],[4.66399,272.032],[4.6648,0.46821009],[4.66531,0.17844],[4.666,0.02086175],[4.66667,0.06745456],[4.6667,3.89873143],[4.668,75.0756],[4.6681,0.01],[4.67,627.59],[4.67003,0.28322944],[4.6746,0.46817119],[4.675,0.024],[4.67515,0.12304],[4.67647,0.0674467],[4.6781,0.01],[4.67844,0.02085776],[4.67975,0.04218],[4.68,557.53512443],[4.68003,3.9],[4.6844,0.46810842],[4.685,0.11],[4.68627,0.06744165],[4.68797,1],[4.6881,0.01],[4.68831,5.98345032],[4.68909,50],[4.69,116],[4.69003,2.9],[4.69066,0.34349],[4.69088,0.02085761],[4.691,80.99141334],[4.69314,2.30986],[4.69347,0.10226],[4.69386,8.30858611],[4.6942,0.4680643],[4.69488,0.37378],[4.695,0.01],[4.69608,0.06743429],[4.69716,9.60347],[4.69774,14.92211755],[4.6981,0.01],[4.69868,0.29964],[4.7,496.1678],[4.70003,4.9],[4.70015,3.5],[4.7002,10],[4.70111,8.8],[4.7012,9.9],[4.70151,3.58371884],[4.702,0.04659506],[4.70279,0.32854087],[4.70316,20.625],[4.70332,0.02086566],[4.70391,0.1344],[4.704,0.46820054],[4.70446,1.99994526],[4.705,0.01],[4.70524,0.29118606],[4.70588,0.06745871],[4.70696,0.25710766],[4.708,50],[4.7081,0.01],[4.70829,2.935717],[4.71,695.32622142],[4.71013,5.2010454],[4.7105,3.73631312],[4.71072,25.55555],[4.711,110],[4.71183,1.69607879],[4.712,50],[4.7121,3],[4.7126,3],[4.71314,250],[4.7138,0.46816023],[4.714,100],[4.71448,4.8771294],[4.715,0.01],[4.71506,0.80628166],[4.71569,0.06746551],[4.71577,0.0208653],[4.71675,1],[4.71937,0.51236055],[4.7199,33.51],[4.72,110],[4.7201,10],[4.721,0.01],[4.72168,6.67201393],[4.7236,0.46815733],[4.72365,1.79183938],[4.7241,233.71113922],[4.725,10],[4.72549,0.06755863],[4.72566,3.58716708],[4.72821,0.02086434],[4.73,100],[4.73035,0.42221637],[4.73072,0.35684087],[4.731,16.9097],[4.73191,0.39125715],[4.7334,0.46853781],[4.73351,0.1792],[4.73451,0.3473],[4.735,0.02],[4.73529,0.06754581],[4.73549,1.37208003],[4.73566,0.15739516],[4.73623,4.30236668],[4.73875,0.25],[4.7389,4.03805449],[4.74,101.038899],[4.74003,4.9],[4.74065,0.0208652],[4.741,0.84629532],[4.743,10.12232764],[4.7432,0.46851495],[4.7435,0.10743],[4.74499,5],[4.745,0.02],[4.7451,0.06753615],[4.74592,0.93333333],[4.74631,0.25],[4.74731,1.13856294],[4.74775,0.03426],[4.7486,0.27653],[4.74877,0.61590541],[4.75,869.26891998],[4.75001,1],[4.75003,1.9],[4.75004,0.502235],[4.7501,10],[4.75012,9.9],[4.75036,2.73785329],[4.7511,6],[4.75121,50],[4.75136,0.88386331],[4.75211,81],[4.75282,3],[4.753,0.62979586],[4.75309,0.02086273],[4.7532,5],[4.7549,0.0675744],[4.755,0.02],[4.75531,1.09369535],[4.75863,7.55625043],[4.76,108.02786386],[4.76001,389.82071466],[4.76078,1.13137232],[4.76092,0.32989],[4.762,155],[4.76201,8.52627756],[4.7628,0.46861825],[4.76471,0.06756261],[4.76508,8.02991094],[4.76554,0.02086067],[4.76656,8],[4.76755,0.26446284],[4.77,130.71],[4.77122,4.4000052],[4.7726,0.46855322],[4.7728,0.81862499],[4.77451,0.06754397],[4.7746,0.58855665],[4.7748,0.02],[4.77485,8.75479327],[4.77798,0.02085821],[4.7782,0.13064773],[4.78,131.1903],[4.78051,7.00537757],[4.7807,84.5158259],[4.78086,2.54864904],[4.782,5.17003764],[4.7824,0.46860005],[4.7828,2.5],[4.78317,0.02551],[4.78431,0.06754902],[4.7848,0.02],[4.78489,5.99925128],[4.78805,0.30243],[4.78916,250],[4.78988,0.06932],[4.79,172.7557],[4.79001,22],[4.79042,0.02085879],[4.79049,8.3117956],[4.7922,0.46844627],[4.79223,1],[4.79267,0.71587155],[4.79366,0.65408],[4.79376,6.72043],[4.794,0.21019324],[4.79412,0.06753035],[4.79468,1.28332556],[4.7948,0.02],[4.79589,4.14366211],[4.79674,0.26934],[4.79899,0.21168],[4.79997,1.34078838],[4.8,1442.69307455],[4.80002,1.68715955],[4.8001,300],[4.80015,1.5],[4.80017,0.70509685],[4.8002,13.59717928],[4.80033,0.91267321],[4.8005,36.6554],[4.80068,2.79276249],[4.801,50],[4.80159,1.04520699],[4.802,0.46838314],[4.80286,0.02085603],[4.80322,1.54583307],[4.80392,0.06751394],[4.80453,2.69004296],[4.8049,0.02],[4.80494,25.55555],[4.805,32],[4.80576,0.12336],[4.80684,5.79649733],[4.80723,0.17274],[4.80728,0.93892452],[4.81,763.4671372],[4.811,110],[4.81176,1.73068399],[4.8118,0.46832044],[4.81219,0.03865],[4.81225,15.00427422],[4.813,21],[4.81373,0.06749558],[4.8145,1.5999626],[4.8149,0.02],[4.815,30.98666666],[4.81506,6.13604404],[4.81531,0.02085248],[4.81638,0.18843],[4.81737,1.79926356],[4.82,351.28841286],[4.8216,0.46798654],[4.82238,2.76052497],[4.8235,0.14465844],[4.82353,0.0674571],[4.82444,0.50630124],[4.8247,9.06],[4.8249,0.02],[4.82504,5.66095436],[4.82554,0.43088],[4.82616,4.45195939],[4.82775,0.02084933],[4.82826,0.95922069],[4.8288,0.42221637],[4.829,102.5],[4.82963,10.39807232],[4.83,100],[4.83001,7.5],[4.83003,57.37889062],[4.8304,35.4008],[4.83079,4.20391112],[4.8308,0.15],[4.83089,0.89699],[4.83111,76],[4.8314,0.46784033],[4.83144,10.99926],[4.83178,2.28113711],[4.83309,1.597865],[4.83333,0.06743601],[4.8338,0.75805],[4.83429,1.58839326],[4.83441,1.84467597],[4.8349,0.02],[4.83595,4.16378607],[4.83865,9.09409],[4.8387,8.02096925],[4.84,100.2],[4.84019,0.02083012],[4.84041,0.36452],[4.8406,0.72418953],[4.8412,0.46770332],[4.84245,3.51564982],[4.84314,0.0674248],[4.84328,0.08145],[4.84388,2.38029739],[4.8449,0.02],[4.84495,2.11559199],[4.8484,0.2147],[4.84846,2.58132603],[4.84854,0.08063],[4.84929,0.12837],[4.84941,8.24510003],[4.84947,0.4224275],[4.85,510.84376134],[4.8501,214.10426382],[4.85015,5],[4.851,0.46811005],[4.85171,0.77520618],[4.85263,0.02082654],[4.85294,0.06749661],[4.85395,1.31954699],[4.855,0.02],[4.85505,10],[4.8551,15.7739],[4.85526,61.87276956],[4.86,197.11602674],[4.86004,1.831325],[4.86013,3.8],[4.8608,0.46798981],[4.86084,0.19954],[4.861,82],[4.86104,5.98639079],[4.86275,0.06748282],[4.86314,0.74418017],[4.865,1.34495256],[4.86508,0.02082469],[4.86604,5.21524858],[4.86843,0.126936],[4.87,102.8],[4.8706,0.46788048],[4.87089,7.34332837],[4.87255,0.06746613],[4.87438,3.73333333],[4.875,0.02],[4.87752,0.02080822],[4.87947,1.81318343],[4.88,108.083611],[4.8804,0.467661],[4.8805,1],[4.881,10],[4.88235,0.06744478],[4.88283,0.9418],[4.883,84.88619905],[4.885,0.02],[4.88538,3.3136022],[4.88671,11.255],[4.88674,7.61729143],[4.88819,52.9532],[4.88878,0.02451],[4.8899,1.12129669],[4.88996,0.02079967],[4.89,100],[4.8902,0.4674151],[4.89216,0.06741416],[4.8923,27.8780757],[4.895,0.02],[4.89509,9.41025301],[4.8956,50],[4.8983,0.19678],[4.89844,1.44116005],[4.9,577.30684532],[4.90001,1.07822637],[4.90014,6.8],[4.90051,0.33232035],[4.90101,0.1],[4.90104,25.55555],[4.90113,1.49418917],[4.90196,0.06737963],[4.9023,0.94863841],[4.90241,0.02079699],[4.90242,5.22592806],[4.905,5.3207],[4.90505,6.8],[4.90528,15.72462763],[4.90906,152.01228092],[4.90938,4.79118],[4.90954,0.66204501],[4.9098,0.30547678],[4.90988,0.075],[4.91,29.4761],[4.9101,2.26168952],[4.911,110],[4.9111,4.98912259],[4.91176,0.06736042],[4.91181,0.50772404],[4.912,50],[4.91238,0.19291412],[4.91286,0.02354],[4.91344,4.73721248],[4.91485,0.02084027],[4.915,10.02],[4.91512,5.76884434],[4.91691,25],[4.9173,2.2120829],[4.9196,0.30546788],[4.91976,0.3137],[4.91991,3.03796959],[4.92,10.8705384],[4.92048,0.21076],[4.92111,7.05831611],[4.92157,1.37409767],[4.92166,0.02083],[4.92177,0.83036361],[4.92233,0.8421481],[4.923,0.9994],[4.92342,3.42875078],[4.92469,80],[4.92487,6.26686162],[4.925,0.02],[4.92574,10],[4.92579,0.0892],[4.92663,2.93441798],[4.92694,0.24083],[4.92729,0.02083519],[4.92764,7.28221044],[4.9294,0.30535869],[4.92979,4.489245],[4.93137,0.06730525],[4.9336,2.50191736],[4.93417,0.216],[4.93422,0.0508],[4.93439,2.20699],[4.93449,2.38962945],[4.935,0.02],[4.93557,4.66864875],[4.93898,37.84403381],[4.93902,2.51557963],[4.9392,0.30534981],[4.93971,0.7700503],[4.93973,0.02078266],[4.93979,1.97426182],[4.93995,1.68886],[4.94,8.78003036],[4.94118,0.06731934],[4.94119,1.28495076],[4.94239,1.89734435],[4.94468,0.06122],[4.94498,0.35329893],[4.945,0.02],[4.9451,0.25721883],[4.9452,2.05023052],[4.94647,0.69949896],[4.947,136.75474024],[4.94706,4.24789615],[4.949,0.30554789],[4.94938,1.90064761],[4.94945,0.16188],[4.95,58.472],[4.95011,1.22993],[4.95098,0.0672952],[4.951,213.73570995],[4.9511,7.4544],[4.95218,0.02082602],[4.95315,1.03482958],[4.955,0.02],[4.95505,5.8991959],[4.9588,0.30554207],[4.95905,0.11917],[4.95919,3.71562162],[4.96078,0.06727211],[4.96217,0.03898],[4.96263,1.72493385],[4.96462,0.02081893],[4.965,0.02],[4.96542,1],[4.96689,2.29283534],[4.9686,0.30552718],[4.96895,8.90047],[4.96922,5.80451978],[4.96945,90.09032],[4.97059,0.0672442],[4.97083,0.39239],[4.9714,0.42699533],[4.97261,85.1458],[4.97349,0.65177295],[4.97399,0.19129],[4.9741,2.65000396],[4.97463,0.22807],[4.97469,3.74104],[4.975,0.02],[4.97506,0.34792839],[4.9758,1],[4.976,7.3899794],[4.97706,29.91954114],[4.9784,0.3049648],[4.97978,0.86666667],[4.98004,1],[4.98005,437],[4.98039,0.03564995],[4.9812,44.05461736],[4.98145,1.76210961],[4.98223,0.1404],[4.98235,2.35785386],[4.985,0.02],[4.98517,11.07246874],[4.98595,0.46044],[4.98675,3.5602367],[4.9882,0.30496627],[4.98824,0.0486],[4.98833,0.63214368],[4.98875,0.01294],[4.98987,1.97523597],[4.99,0.2],[4.99002,1],[4.9902,0.03562137],[4.99077,0.08107],[4.99122,0.55508],[4.99249,0.01094],[4.99439,0.10755],[4.995,0.02],[4.99593,3.40598648],[4.998,0.30494354],[4.99906,25.55555],[4.99934,1.25031226],[4.9999,5.94568491],[5,3712.37659138],[5.00001,400],[5.00003,200],[5.0003,0.12687],[5.00062,2.27639516],[5.00067,0.18752],[5.00071,4.53605784],[5.001,10],[5.00493,234],[5.00494,0.06593],[5.005,30.02],[5.00504,0.74343174],[5.00508,0.61352],[5.00537,15.42292467],[5.0078,0.30335458],[5.00918,1.34766385],[5.0098,0.0352614],[5.00988,0.27149],[5.01,250.70253692],[5.0101,1.15],[5.01025,12.68908148],[5.011,110.92180802],[5.0117,23.47218508],[5.01171,9.33044499],[5.01243,2],[5.01436,1.21172595],[5.01455,14],[5.01477,1.49320988],[5.015,0.02],[5.0156,12],[5.0176,0.30333801],[5.01846,5.56692621],[5.01961,0.03522872],[5.01986,2.06544636],[5.02,0.19],[5.021,2.54],[5.02111,0.01017],[5.02239,0.70899106],[5.02256,11.29943502],[5.025,290.61970746],[5.02559,0.33068629],[5.02574,10],[5.0267,180],[5.02681,2.52362036],[5.0271,650],[5.0274,0.30332148],[5.0276,0.02],[5.02778,0.26486],[5.028,65],[5.02941,0.03519179],[5.03,100.2418],[5.03024,9.78930601],[5.0303,3],[5.031,27.05197376],[5.037,54.11500001],[5.03703,100],[5.03713,6.8417],[5.0372,0.30327325],[5.0376,0.02],[5.038,0.38582825],[5.03803,48.39977531],[5.03914,2.73142],[5.03922,0.03515216],[5.04,5.8051],[5.04001,1.50539939],[5.04141,0.0264],[5.04349,0.46496103],[5.047,0.30325687],[5.04736,2.23011149],[5.0476,0.02],[5.04798,0.03603],[5.04902,0.03511898],[5.05,120.09033465],[5.05049,4.63774],[5.05064,7.3361866],[5.05074,7.90571],[5.05185,0.24602],[5.05235,0.06705],[5.05245,0.14559],[5.0568,0.30324054],[5.05741,10],[5.0576,0.02],[5.05808,0.85681571],[5.05879,0.0331],[5.05882,0.03508389],[5.05906,117.08286914],[5.06,90.30733201],[5.06499,48.53401],[5.06545,1.70833671],[5.06643,0.01028],[5.0666,0.30322422],[5.0676,0.02],[5.06863,0.03505091],[5.06906,170],[5.06971,0.13505],[5.06992,1.16675],[5.07,0.19],[5.07061,0.46035],[5.07588,0.46364],[5.0764,0.30320795],[5.0776,0.02],[5.07843,0.03502168],[5.07863,189.03084038],[5.07906,165.14244653],[5.07985,11.86838598],[5.0799,9.6623],[5.08,200],[5.08104,3.53634688],[5.08111,8.8314],[5.08154,0.09411],[5.08156,8.53551794],[5.082,5],[5.08457,0.14516],[5.08498,0.94888994],[5.0862,0.30319173],[5.0875,0.01235],[5.0876,0.02],[5.08824,0.03499296],[5.08904,0.04171],[5.09,1.36],[5.09072,0.5829158],[5.0912,1.13288],[5.096,0.30317552],[5.09747,0.05584],[5.09753,0.06626],[5.0976,0.02],[5.09804,0.03496535],[5.09853,2.248089],[5.09904,25.55555],[5.1,12],[5.10091,2.21962908],[5.101,50],[5.10242,0.03945],[5.1047,0.05821],[5.10489,0.13485],[5.1058,0.30315936],[5.10706,1.88502],[5.1076,0.02],[5.10784,0.03493663],[5.11,157.69984344],[5.11398,19.05783435],[5.1156,0.30314324],[5.11565,9.26329648],[5.1176,0.02],[5.11765,0.03491922],[5.11964,0.1065],[5.12002,0.46256362],[5.12261,0.01392],[5.12301,0.15349],[5.12391,1.688819],[5.12445,0.18013],[5.12502,0.34651417],[5.1254,0.30301586],[5.12552,6.8215],[5.12593,7.77693],[5.12602,0.10294],[5.1264,7.28318849],[5.12745,0.03491118],[5.1276,0.02],[5.12823,0.19812],[5.12869,26.74352],[5.1299,0.45],[5.13,1.0292],[5.1304,6.93997882],[5.13419,0.017],[5.13514,0.03548],[5.1352,0.303],[5.13725,0.03489572],[5.1376,0.02],[5.13872,0.27252],[5.14019,2.18919],[5.145,0.30306351],[5.1453,0.28378],[5.14706,0.03487428],[5.1476,0.02],[5.14813,27.41617706],[5.14864,0.12907],[5.14912,1.1278554],[5.14929,4.09368747],[5.15,65.8114728],[5.15038,2.07186],[5.1531,87.16964673],[5.15366,0.014],[5.15393,21.44084959],[5.1548,0.30304757],[5.15686,0.03485608],[5.15813,0.09645],[5.15964,0.03329],[5.15998,0.02548],[5.16,151.0233],[5.16012,6],[5.1646,0.30303168],[5.16545,0.01423],[5.16667,0.03484034],[5.1668,0.02],[5.17,33.9033],[5.17115,12.51476],[5.17246,0.93293],[5.17379,0.07625],[5.17413,0.05256],[5.1744,0.30301583],[5.17506,2.4106008],[5.17647,0.03482632],[5.1768,0.02],[5.17746,0.75456],[5.17858,7.79709],[5.18,1.0193],[5.1801,0.03933906],[5.184,0.108],[5.1842,0.303],[5.18464,1.91799131],[5.18627,0.03481039],[5.18646,0.01479],[5.18754,0.63326],[5.18808,0.91661],[5.19,1.0173],[5.1909,0.02],[5.19314,0.01176],[5.19409,0.1187],[5.19438,0.04346],[5.19608,0.0347479],[5.2,49.9122173],[5.201,661.0267],[5.20105,0.01047],[5.20142,1.34799078],[5.20665,0.01015],[5.20982,0.05506],[5.21,16.0134],[5.21022,1.4842556],[5.21222,0.08468],[5.21412,0.07348],[5.2151,0.03304],[5.21586,0.05315],[5.21598,2.6636],[5.21677,0.6286],[5.21694,1.13967862],[5.21757,0.01513],[5.21905,7.65497],[5.21936,0.07525],[5.2203,1.83960058],[5.22265,0.1418],[5.22273,0.08917],[5.224,27],[5.23,8],[5.23232,6.8],[5.235,452.68439159],[5.237,50],[5.23723,0.04155],[5.24,120],[5.25565,1.76294124],[5.25754,0.02313],[5.25838,0.51206],[5.269,34.8588]]}"
            MtGoxDepthInfo depthInfo = new MtGoxDepthInfo();
            string json = jsonDataStr;
            var serializer = new JavaScriptSerializer();
            serializer.RegisterConverters(new[] { new DynamicJsonConverter() });
            dynamic obj = serializer.Deserialize(json, typeof(object));            
            // extract ask info from returned data
            for (int i = 0; i < obj.asks.Count; i++)
            {
                MtGoxAsk a = new MtGoxAsk();
                a.price = double.Parse(obj.asks[i][0].ToString());
                a.amount = double.Parse(obj.asks[i][1].ToString());
                depthInfo.asks.Add(a);
            }
            // extract bid info from returned data
            for (int i = 0; i < obj.bids.Count; i++)
            {
                MtGoxBid b = new MtGoxBid();
                b.price = double.Parse(obj.bids[i][0].ToString());
                b.amount = double.Parse(obj.bids[i][1].ToString());
                depthInfo.bids.Add(b);
            }
            return depthInfo;
        }
    }
}
